home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / src / sysexits.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-18  |  2.4 KB  |  77 lines

  1. /*
  2.  * Copyright (c) 1983 Eric P. Allman
  3.  * Copyright (c) 1988 Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms are permitted provided
  7.  * that: (1) source distributions retain this entire copyright notice and
  8.  * comment, and (2) distributions including binaries display the following
  9.  * acknowledgement:  ``This product includes software developed by the
  10.  * University of California, Berkeley and its contributors'' in the
  11.  * documentation or other materials provided with the distribution and in
  12.  * all advertising materials mentioning features or use of this software.
  13.  * Neither the name of the University nor the names of its contributors may
  14.  * be used to endorse or promote products derived from this software without
  15.  * specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  */
  20.  
  21. #ifndef lint
  22. static char sccsid[] = "@(#)sysexits.c    5.6 (Berkeley) 6/1/90";
  23. static char  rcsid[] = "@(#)$Id: sysexits.c,v 5.6.0.2 1991/05/18 18:30:38 paul Exp $";
  24. #endif /* not lint */
  25.  
  26. #include <sysexits.h>
  27.  
  28. /*
  29.  *  SYSEXITS.C -- error messages corresponding to sysexits.h
  30.  */
  31. char *SysExMsg[] = {
  32.     /* 64 USAGE */        "500 Bad usage",
  33.     /* 65 DATAERR */    "501 Data format error",
  34.     /* 66 NOINPUT */    "550 Cannot open input",
  35.     /* 67 NOUSER */        "550 User unknown",
  36.     /* 68 NOHOST */        "550 Host unknown",
  37.     /* 69 UNAVAILABLE */    "554 Service unavailable",
  38.     /* 70 SOFTWARE */    "554 Internal error",
  39.     /* 71 OSERR */        "451 Operating system error",
  40.     /* 72 OSFILE */        "554 System file missing",
  41.     /* 73 CANTCREAT */    "550 Can't create output",
  42.     /* 74 IOERR */        "451 I/O error",
  43.     /* 75 TEMPFAIL */    "250 Deferred",
  44.     /* 76 PROTOCOL */    "554 Remote protocol error",
  45.     /* 77 NOPERM */        "550 Insufficient permission",
  46.     /* 78 CONFIG */        "554 Local configuration error",
  47. };
  48.  
  49. int N_SysEx = sizeof(SysExMsg) / sizeof(SysExMsg[0]);
  50.  
  51. /*
  52.  *  STATSTRING -- return string corresponding to an error status
  53.  *
  54.  *    Parameters:
  55.  *        stat -- the status to decode.
  56.  *
  57.  *    Returns:
  58.  *        The string corresponding to that status
  59.  *
  60.  *    Side Effects:
  61.  *        none.
  62.  */
  63. char *
  64. statstring(stat)
  65.     int stat;
  66. {
  67.     static char ebuf[50];
  68.  
  69.     stat -= EX__BASE;
  70.     if (stat < 0 || stat >= N_SysEx)
  71.     {
  72.         (void)sprintf(ebuf, "554 Unknown status %d", stat + EX__BASE);
  73.         return(ebuf);
  74.     }
  75.     return(SysExMsg[stat]);
  76. }
  77.